require('./Listitem.styl');
import { Boxs } from 'saltui'
import Icon from 'salt-icon'
import { Control } from 'react-keeper'
const { HBox, Box, VBox } = Boxs;
class Listitem extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        };
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick(params) {
        if (this.props.refreshing) return;
        let { scoreId,placeId} = params;
        Control.go('/home/detail',{scoreId,placeId});
    }
    render() {
        return (
            <div className="teacher-listitem" >
                <VBox >
                    <HBox vAlign="center" className="teacher-listitem-head">
                        <Box flex={1} className="teacher-listitem-title">
                            {this.props.title}
                        </Box>
                        <Box flex={1} className="t-FAR teacher-listitem-date">
                            {this.props.checkDate}
                        </Box>
                    </HBox>
                    {this.props.scoreList.map((item, index) => {
                        return (
                            <HBox vAlign="center" onClick={this.handleClick.bind(this,item)} className="teacher-listitem-body">
                                <Box flex={3} className="teacher-listitem-place">
                                    <span>{item.placeName}</span><span className="color t-ML2">({item.teacherName}&nbsp;&nbsp;&nbsp;{item.checkTime})</span>
                                </Box>
                                <Box flex={1} className="t-FAR">
                                    {item.score}
                                </Box>
                            </HBox>
                        )
                    })}
                </VBox>
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

module.exports = Listitem;
